//
// Created by wze-zero on 2024/7/14 014.
//
#include <iostream>

using namespace std;

void func(int *p, int n);

int main() {
    int arr[6];
    for (int i = 0; i < 6; i++) {
        cin >> arr[i];
    }
    func(arr, 6);
    for (int i = 0; i < 6; i++) {
        if (i == 5) {
            cout << arr[i] << endl;
        } else {
            cout << arr[i] << " ";
        }
    }
    return 0;
}

void func(int *p, int n) {
    int *ptr = p, *pst = p;
    for (int i = 0; i < n; ++i, ++ptr) {
        if (*ptr != 0) {
            *pst = *ptr;
            ++pst;
        }
    }
    while (pst != ptr) {
        *pst = 0;
        pst++;
    }
}